<?php
//No direct access
defined('_JEXEC') or die('Restricted access');

jimport('joomla.application.component.view');

class OwnserviceViewHistory extends JView
{
	function display($tpl=null){

		global $mainframe, $option;

		//Initialise variables
		$user			= & JFactory::getUser();
		$ownuser	= & Ownservice::getUser();
		$document	= & JFactory::getDocument();
		$db			= & JFactory::getDBO();

		//get vars
		$level			= $ownuser->get('level_id');
		$nullDate		= $db->getNullDate();

		//$filter_status		= $mainframe->getUserStateFromRequest($option.'.history.filter_status', 'filter_status','','word');
		$filter_account		= $mainframe->getUserStateFromRequest($option.'.history.filter_account', 'filter_account','','string');

		//add style to document
		$document->addStyleSheet(JURI::base().'/components/com_ownservice/assets/css/style.css');
		$document->addStyleSheet(JURI::base().'/components/com_ownservice/assets/css/nav.css');

		//get data form the model
		$model			= $this->getModel();
		$rows				=& $this->get('Data');
		$profile			=& $this->get('Profile');
		$totalTransfer	= $this->get('TotalTransfer');
		$accounts		= $this->get('Accounts');

		$lists = array();

		//build accounts select list
		$lists['account'] = OwnserviceHelper::buildbanksselect($accounts, 'filter_account', $filter_account, true, 'class="inputbox" onchange="submitform( );"');
		//build status select list
		//$lists['status'] = OwnserviceHelper::buildfilterstatuslist('filter_status', $filter_status, true, 'class="inputbox" onchange="submitform( );"');

		$this->assignRef('level', $level);
		$this->assignRef('rows', $rows);
		$this->assignRef('accounts', $accounts);
		$this->assignRef('profile', $profile);
		$this->assignRef('user', $user);
		$this->assignRef('ownuser', $ownuser);
		$this->assignRef('totalTransfer', $totalTransfer);
		$this->assignRef('lists', $lists);
		$this->assignRef('nullDate', $nullDate);

		parent::display($tpl);
	}
}
?>